package autoteam;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import db.DBRecord;

public class Referee
{
	private String firstname;
	private String lastname;
	private Sports sport;
	private boolean[] availNights;
	private int numYearsExperience;
	private String gamesRefing;
	private String phone;
	private String email;
	private double salary;
	private Date bday;
	private String pathToPicture;
	
	public Referee(String firstname, String lastname)
	{
		this.firstname = firstname;
		this.lastname = lastname;
	}
	
	public String getFirstname()
	{
		return firstname;
	}

	public void setFirstname(String firstname)
	{
		this.firstname = firstname;
	}

	public String getLastname()
	{
		return lastname;
	}

	public void setLastname(String lastname)
	{
		this.lastname = lastname;
	}

	public Sports getSport()
	{
		return sport;
	}

	public void setSport(Sports sport)
	{
		this.sport = sport;
	}

	public boolean[] getAvailNights()
	{
		return availNights;
	}

	public void setAvailNights(boolean[] availNights)
	{
		this.availNights = availNights;
	}

	public int getNumYearsExperience()
	{
		return numYearsExperience;
	}

	public void setNumYearsExperience(int numYearsExperience)
	{
		this.numYearsExperience = numYearsExperience;
	}

	public String getGamesRefing()
	{
		return gamesRefing;
	}

	public void setGamesRefing(String gamesRefing)
	{
		this.gamesRefing = gamesRefing;
	}

	public String getPhone()
	{
		return phone;
	}

	public void setPhone(String phone)
	{
		this.phone = phone;
	}

	public String getEmail()
	{
		return email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public double getSalary()
	{
		return salary;
	}

	public void setSalary(double salary)
	{
		this.salary = salary;
	}

	public Date getBday()
	{
		return bday;
	}

	public void setBday(Date bday)
	{
		this.bday = bday;
	}

	public String getPathToPicture()
	{
		return pathToPicture;
	}

	public void setPathToPicture(String pathToPicture)
	{
		this.pathToPicture = pathToPicture;
	}
	
	public DBRecord createRecord()
	{
		DBRecord refRec = new DBRecord();
		refRec.addField("firstname", firstname);
		refRec.addField("lastname", lastname);
		refRec.addField("bday", bday);
		refRec.addField("email", email);
		refRec.addField("gamesRefing", gamesRefing);
		refRec.addField("numYearsExperience", numYearsExperience);
		refRec.addField("pathToPicture", pathToPicture);
		refRec.addField("phone", phone);
		refRec.addField("sport", sport.toString());
		String nights = "";
		Map<Integer,String> m = new HashMap<Integer, String>();
		m.put(0, "m");
		m.put(1, "t");
		m.put(2, "w");
		m.put(3, "r");
		m.put(4, "f");
		for(int i = 0; i < availNights.length; i++)
		{
			if (availNights[i])
				nights += m.get(i);
		}
		refRec.addField("availNights", nights);
		return refRec;
	}

	
}
